<template>
  <div id='tmpl'>
    <div class="title">
      <h4>{{ info.title }}</h4>
      <p>
        {{ info.add_time | date("YYYY-MM-DD HH:mm:ss") }} {{ info.click }} 次点击
      </p>
    </div>
    <div id="content" v-html="info.content"></div>

    <!-- 实现评论组件的集成 -->
    <comment :id="id"></comment>
  </div>
</template>
<script>
import { Toast } from "mint-ui";
//导入评论组件
import comment from "../subcom/comment.vue";
export default {
  
  components:{
    comment   //注册评论组件
  },
  data() {
    return {
      info: {},
      id:this.$route.params.id
    };
  },
  created() {
    this.getNewInfo();
  },
  methods: {
    getNewInfo() {
      var url =this.$common.apidomain + "/api/getnew/" + this.id;
      this.$http.get(url).then(res => {
        var data = res.body;
        if (data.status != 0) {
          Toast(data.message);
          return;
        }
        this.info = data.message[0];
      });
    }
  }
};
</script>
<style lang="css" scoped>
h4 {
  color: #0094ff;
}
.title p {
  color: rgba(0, 0, 0, 0.5);
}
.title,
#content {
  padding: 5px;
}

</style>